Skip to content

Adding null check before clearing mouseDownTimeout#201

Open
nzayatz14 wants to merge 2 commits intoreact-component:masterfrom
nzayatz14:master
Open

Adding null check before clearing mouseDownTimeout#201
nzayatz14 wants to merge 2 commits intoreact-component:masterfrom
nzayatz14:master

Conversation

@nzayatz14
Copy link
Copy Markdown

Hello,

I was recently doing some performance testing on a virtual table component I had written. With rows constantly unmounting & remounting, I wanted to make sure the scroll was still smooth with tooltips (rc-tooltips to be exact).

During my tests, I noticed that a significant amount of my table cells needed to clear a timeout upon unmounting of the row, this caused lag in my scrolling.

Screen Shot 2020-09-25 at 3 59 39 PM

I found the call was made by rc-trigger in it's componentWillUnmount function. I added a simple null-check before the clearTimeout function and it significantly improved my scrolling performance.

I also noticed that the other timer, this.delayTimer, has its own function that handles this case -> this.clearDelayTimer() and was wondering why this.mouseDownTimeout did not have something similar.

Thanks!
Nick

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 25, 2020

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.22%. Comparing base (b8b8cb2) to head (67c7afc).
⚠️ Report is 351 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #201   +/-   ##
=======================================
  Coverage   88.22%   88.22%           
=======================================
  Files          10       10           
  Lines         484      484           
  Branches      121      122    +1     
=======================================
  Hits          427      427           
  Misses         57       57           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shc023
Copy link
Copy Markdown

shc023 commented Jul 31, 2021

I was also running into perf issue caused by the same code when unmounting 10k+ rc-tooltip at the same time. I made a PR that does this and also clears the pointer itself after executing, which potentially gives even more performance gain:

#278

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants